<template>
  <div class="user_module">

    <van-cell-group>
      <van-cell title="我的资产"/>
      <van-grid :column-num="2">
        <van-grid-item>
          <van-cell label="可提现收益" to="user/income">
            <template #title>
              <span class="red">{{withdrawAmount  * 100 | yuan}}</span>
            </template>
          </van-cell>
        </van-grid-item>
        <van-grid-item icon="photo-o">
          <van-cell label="累计收益" to="user/income">
            <template #title>
              <span class="red">{{totalAmount  * 100 | yuan}}</span>
            </template>
          </van-cell>
        </van-grid-item>
      </van-grid>


      <van-cell icon="fenxiang" title="推广挣钱" to="/user/promote" isLink/>
      <van-cell icon="compass" title="我的收益" to="/user/income" isLink/>
      <van-cell icon="dingwei" title="地址管理" to="/user/address" isLink/>
      <van-cell icon="kefu" title="服务中心" to="/user/server" isLink/>
      <van-cell icon="set" title="设置" to="user/information" isLink/>
    </van-cell-group>




  </div>


</template>

<script>
  import {Grid, GridItem} from 'vant';
  import {getLocalStorage} from "@/utils/local-storage";

  export default {
  name: 'user-module',
  data() {
    return {
      withdrawAmount:0,
      totalAmount:0
    };
  },
  activated() {
    this.getAssets();
  },
  methods: {
    getAssets() {
      const infoData = getLocalStorage(
          'withdrawAmount','totalAmount'
      );
      this.withdrawAmount = infoData.withdrawAmount;
      this.totalAmount = infoData.totalAmount;
    }
  },
  components: {
    [Grid.name]: Grid,
    [GridItem.name]: GridItem,
  }
};
</script>


<style scoped lang="scss">
.user_module {
  background-color: #fff;
}
.van-grid{
  text-align: center;
}
</style>
